﻿@{
    ViewBag.Title = "Quản lý chủ đề";
    Layout = "~/Areas/Admin/Views/Shared/__AdminLayout.cshtml";
}
@section _Head{
    <script type="text/javascript">
        $("#nav-left").accordion("activate", 4);
    </script>
 }
<h2>Quản lý chủ đề</h2>

<script type="text/javascript">
    var ListViewIndex = 0;
    var ListViewRecord = 10;

    $(document).ready(function () {     
        LoadTopic();
    });  

    function LoadTopic() {

        jQuery("#list_container").showLoading();
       
        $.ajax({
            type: "POST",
            url: "/Admin/Topic/GetDisplayForAdmin",
            data: ({ maxRecord: ListViewRecord, currentPage: ListViewIndex }),
            dataType: "json",
            error: function (xhr, status, error) {
            },
            success: function (d) {
                if (d != null) {

                    if (d.OperationComplete != null && d.OperationComplete == false && d.ErrorCode != null) {
                        if (d.ErrorFriendlyMessage != null) {
                            ShowErrorMessage(d.ErrorFriendlyMessage);
                        }
                        return;
                    }

                    CreateLayout(d.Data);

                }
            },
            complete: function () {
                jQuery("#list_container").hideLoading();
            },
            cache: false
        });    //end ajax
    }

   

    function CreateLayout(data) {

        $('#sealight_list').setTemplate($('#list_template').html());
        $('#sealight_list').processTemplate(data);       
    }

     

</script>
<div id="manage_container">  
    <div id="list_container">       
        <br clear="all" />
        <div id="sealight_list">
        </div>
        <br clear="all"/>       
    </div>
</div>
<script type="text/html" id="list_template">
    <table width="500" cellpadding="4" cellspacing="0" border="0" id="sealight_list_items" style="border:1px solid #ccc;" class="tablesorter">	
    <thead>
    <tr>   	
					<th width="450" align="left" bgcolor="#333333">Tên topic</th>									
                    <th width="50" align="left" bgcolor="#333333"></th>
    </tr>
    </thead>
    <tbody>
    {#foreach $T as record}
        <tr class="{#cycle values=['odd','even']}">        	
					<td> {$T.record.name}</td>					
                    <td><a class="edit" href="/admin/topic/addupdate/{$T.record.id}" style="color:#06C;">Sửa</a></td>   
        </tr>
    {#/for}
    </tbody>

</table>
</script>
